﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.MarketUI {
    import flash.events.*;
    import flash.display.*;
    import Events.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.util.*;
    import Display.*;
    import Display.aswingui.*;

    public class TabbedCatalog extends Catalog {

        public static var assetDict:Dictionary;

        public var m_types:Array;
        protected var m_assetDependenciesLoaded:int;
        protected var m_assetDependencies:Dictionary;

        public function TabbedCatalog(_arg1:String, _arg2:ItemCatalogUI, _arg3:String, _arg4:Array, _arg5:String, _arg6:Boolean){
            this.m_assetDependenciesLoaded = 0;
            this.m_assetDependencies = new Dictionary();
            this.m_types = _arg4;
            super(_arg1, _arg2, _arg3, false, _arg5, _arg6);
        }
        override protected function getScrollHeight():int{
            return ((Catalog.SCROLL_HEIGHT - Catalog.TAB_HEIGHTOFFFSET));
        }
        protected function getAssetDependencies():Array{
            return ([DelayedAssetLoader.MARKET_ASSETS, DelayedAssetLoader.TABBED_MARKET_ASSETS]);
        }
        override protected function loadAssets():void{
            var _local1:String;
            for each (_local1 in this.getAssetDependencies()) {
                Global.delayedAssets.get(_local1, this.makeAssets);
            };
        }
        override protected function makeAssets(_arg1:DisplayObject, _arg2:String):void{
            var _local3:int = this.getAssetDependencies().length;
            this.m_assetDependenciesLoaded++;
            this.m_assetDependencies[_arg2] = _arg1;
            if ((((_local3 == 1)) || ((_arg2 == DelayedAssetLoader.MARKET_ASSETS)))){
                m_comObject = _arg1;
            };
            if (this.m_assetDependenciesLoaded >= _local3){
                this.setChrome(new Event("loaded"));
            };
        }
        override protected function setChrome(_arg1:Event):void{
            TabbedCatalog.assetDict = new Dictionary(true);
            TabbedCatalog.assetDict["bg"] = m_comObject.marketBG;
            TabbedCatalog.assetDict["btn_left_offstate"] = m_comObject.market_prev_up;
            TabbedCatalog.assetDict["btn_left_onstate"] = m_comObject.market_prev_over;
            TabbedCatalog.assetDict["btn_left_downstate"] = m_comObject.market_prev_down;
            TabbedCatalog.assetDict["btn_right_offstate"] = m_comObject.market_next_up;
            TabbedCatalog.assetDict["btn_right_onstate"] = m_comObject.market_next_over;
            TabbedCatalog.assetDict["btn_right_downstate"] = m_comObject.market_next_down;
            TabbedCatalog.assetDict["card_available_selected"] = m_comObject.marketItem;
            TabbedCatalog.assetDict["card_limited_item"] = m_comObject.limitedMarketItem;
            TabbedCatalog.assetDict["card_limited_counter"] = m_comObject.limitedMarketItemCounter;
            TabbedCatalog.assetDict["card_available_unselected"] = m_comObject.marketItem;
            TabbedCatalog.assetDict["card_locked"] = m_comObject.marketItem_locked;
            TabbedCatalog.assetDict["icon_coins"] = m_comObject.coin;
            TabbedCatalog.assetDict["icon_cash"] = m_comObject.cash;
            TabbedCatalog.assetDict["icon_goods"] = m_comObject.goods;
            TabbedCatalog.assetDict["sale_tag"] = m_comObject.market_saletag;
            TabbedCatalog.assetDict["pop_lock"] = m_comObject.lockedArea;
            TabbedCatalog.assetDict["pop_neighborlock"] = m_comObject.lockedNeighborArea;
            TabbedCatalog.assetDict["saleSticker"] = m_comObject.franchise_saleSticker;
            TabbedCatalog.assetDict["selectedTab"] = m_comObject.selectedTab;
            var _local2:Object = this.m_assetDependencies[DelayedAssetLoader.TABBED_MARKET_ASSETS];
            TabbedCatalog.assetDict["tab_bg"] = _local2.factories2_0_bg;
            TabbedCatalog.assetDict["card_locked"] = _local2.factories2_0_card_locked;
            TabbedCatalog.assetDict["tab_active"] = _local2.factories2_0_tab_active;
            TabbedCatalog.assetDict["tab_inactive"] = _local2.factories2_0_tab_inactive;
            TabbedCatalog.assetDict["tab_locked"] = _local2.factories2_0_tab_locked;
            m_content = m_ui;
            asset.init(m_type, this, m_itemName, m_exclusive, m_overrideTitle);
            m_holder = new Sprite();
            this.addChild(m_holder);
            var _local3:JWindow = new JWindow(m_holder);
            _local3.setContentPane(m_ui);
            ASwingHelper.prepare(_local3);
            _local3.show();
            m_content.addEventListener(GenericObjectEvent.ROLLOVER_MARKET_CATEGORY, showCatToolTip, false, 0, true);
            m_content.addEventListener("hidetooltip", hideCatToolTip, false, 0, true);
            m_categoryTooltip = new ItemCategoryToolTip();
            m_tooltip = new ItemCatalogToolTip();
            m_tooltipHolder = new Sprite();
            this.addChild(m_tooltipHolder);
            m_tooltipHolder.mouseChildren = (m_tooltipHolder.mouseEnabled = false);
            m_tooltipHolder.y = -80;
            jtw = new JWindow(m_tooltipHolder);
            jtw.setContentPane(m_tooltip);
            ASwingHelper.prepare(jtw);
            m_cursorId = UI.setCursor(null);
            this.mouseEnabled = (this.mouseChildren = false);
            if (m_itemName != null){
                asset.goToItem(m_itemName);
            };
        }
        override public function get categoryNames():Array{
            return (this.m_types);
        }

    }
}//package Display.MarketUI 
